<?php

/**
 * Abstract plugin for front controller
 *
 */
abstract class Rapide_Controller_Front_Plugin implements Rapide_Controller_Front_Plugin_Interface
{
	/**
	 * Pre dispatch loop
	 * 
	 * This method will be executed before dispatching process.
	 *
	 * @param Rapide_Dispatcher_Token_Interface $oToken
	 * @return Rapide_Dispatcher_Token_Interface token
	 */
	public function preDispatchLoop(Rapide_Dispatcher_Token_Interface $oToken)
	{
		return $oToken;
	}

	/**
	 * Post dispatch loop
	 *
	 * This method will be executed after dispatching process.
	 * 
	 * @param Rapide_Dispatcher_Token_Interface $oToken
	 * @return Rapide_Dispatcher_Token_Interface token
	 */
	public function postDispatchLoop(Rapide_Dispatcher_Token_Interface $oToken)
	{
		return $oToken;
	}

	/**
	 * Pre execution
	 * 
	 * This method will be executed before any action execution.
	 *
	 * @param Rapide_Dispatcher_Token_Interface $oToken
	 * @return Rapide_Dispatcher_Token_Interface token
	 */
	public function preExecution(Rapide_Dispatcher_Token_Interface $oToken)
	{
		return $oToken;
	}

	/**
	 * Post execution
	 * 
	 * This method will be executed after any action execution.
	 *
	 * @param Rapide_Dispatcher_Token_Interface $oToken
	 * @return Rapide_Dispatcher_Token_Interface token
	 */
	public function postExecution(Rapide_Dispatcher_Token_Interface $oToken)
	{
		return $oToken;
	}

	/**
	 * Check out if action is dispatchable
	 *
	 * @param Rapide_Dispatcher_Token_Interface $oToken
	 * @return boolean true if action is dispatchable or false if it is not
	 */
	public function isDispatchable(Rapide_Dispatcher_Token_Interface $oToken)
	{
		return Rapide_Controller_Front::getInstance()
					 ->getDispatcher()
					 ->isDispatchable($oToken);
	}
}

?>